<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='global-property-'>/**
</span> * @ignore
 * Item for KISON
 * @author yiminghe@gmail.com
 */
KISSY.add(&quot;kison/item&quot;, function (S, Base) {
<span id='KISSY-Kison-Item'>    /**
</span>     * grammar item
     * @class KISSY.Kison.Item
     */
    return Base.extend({
        equals: function (other, ignoreLookAhead) {
            var self = this;
            if (!other.get(&quot;production&quot;).equals(self.get(&quot;production&quot;))) {
                return false;
            }
            if (other.get(&quot;dotPosition&quot;) != self.get(&quot;dotPosition&quot;)) {
                return false;
            }
            if (!ignoreLookAhead) {
                if (!S.equals(self.get(&quot;lookAhead&quot;), other.get(&quot;lookAhead&quot;))) {
                    return false;
                }
            }
            return true;
        },

        toString: function (ignoreLookAhead) {
            return this.get(&quot;production&quot;)
                .toString(this.get(&quot;dotPosition&quot;))
                + (ignoreLookAhead ? &quot;&quot; :
                (&quot;,&quot; + S.keys(this.get(&quot;lookAhead&quot;)).join(&quot;/&quot;)));
        },

        addLookAhead: function (ls) {
            var lookAhead = this.get(&quot;lookAhead&quot;), ret = 0;
            S.each(ls, function (_, l) {
                if (!lookAhead[l]) {
                    lookAhead[l] = 1;
                    ret = 1;
                }
            });
            return ret;
        }
    }, {
        ATTRS: {
            production: {},
            dotPosition: {
                value: 0
            },
            lookAhead: {
                /*
                 2012-07-27
                 improve performance,use object to compare( equal )
                 and find( indexOf )
                 instead of array
                 */
                value: {}
            }
        }
    });
}, {
    requires: ['base']
});</pre>
</body>
</html>
